package com.yixiang.np.model;

import java.util.List;

public class PageUtil {
	int currentPage; //当前页
	int prev;// 上一页
	int next;//下一页
	int totalPages;//总页数
	int rowCount;//数据记录总数
	List plist;//存放数据的list
	int pageSize;//每页显示记录数

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	//构造方法
	public PageUtil(int pageindex, int pagesize, int count) {
		this.currentPage=pageindex;
		this.rowCount=count;
		this.pageSize=pagesize;
		totalPages = count % pagesize == 0 ? count / pagesize : count
				/ pagesize + 1;
		if (pageindex <= 1) {
			next = pageindex + 1;
			prev = 1;
		} else if (pageindex >=totalPages) {
			next = totalPages;
			prev = pageindex - 1;
		} else {
			next = pageindex + 1;
			prev = pageindex - 1;
		}
	}
	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getPrev() {
		return prev;
	}

	public void setPrev(int prev) {
		this.prev = prev;
	}

	public int getNext() {
		return next;
	}

	public void setNext(int next) {
		this.next = next;
	}

	public int getTotalPages() {
		return totalPages;
	}

	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}

	public int getRowCount() {
		return rowCount;
	}

	public void setRowCount(int rowCount) {
		this.rowCount = rowCount;
	}

	public List getPlist() {
		return plist;
	}

	public void setPlist(List plist) {
		this.plist = plist;
	}

}
